package com.example.demo.controller;

import com.example.demo.kafka.KafkaProducer;
import com.example.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: FKJGFK
 * @Date: 2021/5/7 10:19
 * @Description:
 */
@RestController
@RequestMapping("/kafka")
public class KafkaController {

    @Autowired
    private User user;

    @Autowired
    private KafkaProducer kafkaProducer;

    @RequestMapping("/createMsg")
    public void createMsg() {
        kafkaProducer.sendUserMessage(user, "11");
    }

    @RequestMapping("/createMsg1")
    public void createMsg1() {
        kafkaProducer.sendUserMessage(user, "topic.test");
    }

    @RequestMapping("/createTopic")
    public void createTopic() {
        kafkaProducer.sendUserMessage(user, "topic-mobile-online-log");
        kafkaProducer.sendUserMessage(user, "topic-app-user-use-log");
        kafkaProducer.sendUserMessage(user, "topic-app-safe-log");
        kafkaProducer.sendUserMessage(user, "topic-app-install-log-topic");
    }
}